import RPi.GPIO as gpio

in_num_to_gpio = [4, 5, 6, 22, 23, 24, 25, 26]


def pin4_isr(ch):
    print('Input Num: %d, GPIO: %d' % (in_num_to_gpio.index(ch)+1, ch))


def init():
    gpio.setmode(gpio.BCM)

    gpio.setup([4, 5, 6, 22, 23, 24, 25, 26], gpio.IN)
    gpio.add_event_detect(4, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(5, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(6, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(22, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(23, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(24, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(25, gpio.BOTH, callback=pin4_isr, bouncetime=100)
    gpio.add_event_detect(26, gpio.BOTH, callback=pin4_isr, bouncetime=100)


if __name__ == '__main__':
    init()
